﻿using Common.Helpers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DataAccessLayer.Helper
{
    public class UpdateText : CommandGenerationBehaviour
    {
        public override string[] SetBaseCommandParameters()
        {
            return new string[] { m_InputObject.SchemaName(), m_InputObject.BaseClassName(), (m_BaseObject.ColumnsToUpdate()), (m_BaseObject.PrimaryKey()) };
        }

        public override string[] SetDerivedCommandParameters()
        {
            return new string[] { m_InputObject.SchemaName(), m_InputObject.GetTableName(), m_InputObject.ColumnsToUpdate(), m_InputObject.PrimaryKey() };
        }

        public override string GetSpecializedCommandText(params string[] input)
        {
            return string.Format("UPDATE {0}.{1} SET {2} WHERE Id={3}", input[0], input[1], input[2], input[3]);
        }
    }
}
